body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  width: 800px;
  height: 600px;
}

.main-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

.search-container {
  width: 320px;
  padding: 0 10px 10px;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  background: white;
}

/* 搜索框容器样式 */
.search-wrapper {
  position: relative;
  margin: 10px 0;
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

/* 搜索图标 */
.search-input-container::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #666;
  pointer-events: none;
  z-index: 1;
}

/* 搜索输入框样式 */
#searchInput {
  width: 100%;
  padding: 10px 45px 10px 35px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #f5f5f5;
  transition: all 0.3s ease;
}

#searchInput:hover {
  background: #e8eaed;
}

#searchInput:focus {
  background: #fff;
  border-color: #4285f4;
  box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.1);
}

/* 添加搜索结果数量显示 */
.search-results-count {
  font-size: 12px;
  color: #666;
  margin: 8px 0;
  padding-left: 2px;
}

/* 修改书签列表的上边距 */
#bookmarksList {
  flex: 1;
  overflow-y: auto;
  margin-top: 5px;
  padding-right: 5px; /* 为滚动条留出空间 */
}

/* 自定义滚动条样式 */
#bookmarksList::-webkit-scrollbar {
  width: 6px;
}

#bookmarksList::-webkit-scrollbar-track {
  background: transparent;
}

#bookmarksList::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

#bookmarksList::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

.bookmark-item {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: all 0.3s ease;
}

.bookmark-item:hover {
  background-color: #f5f5f5;
}

.bookmark-item.ai-result {
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.08), 
    rgba(121, 40, 202, 0.08), 
    rgba(14, 165, 233, 0.08)
  );
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border-radius: 6px;
  margin: 0 2px 1px 2px;
  border-bottom: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.bookmark-item.ai-result::before,
.bookmark-item.ai-result::after {
  content: 'AI';
  position: absolute;
  font-size: 38px;
  font-weight: 900;
  opacity: 0.08;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.3), 
    rgba(121, 40, 202, 0.3)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  letter-spacing: -1px;
  animation: gradientShift 3s ease infinite, floatAI 3s ease-in-out infinite;
  --x: 50%;
}

.bookmark-item.ai-result:hover::before,
.bookmark-item.ai-result:hover::after {
  opacity: 0.15;
  transition: all 0.3s ease;
  transform: scale(1.1) rotate(var(--rotation));
}

.bookmark-item.ai-result::before {
  --rotation: -15deg;
  right: 15%;
  top: 50%;
  transform: translate(50%, -50%) rotate(var(--rotation));
}

.bookmark-item.ai-result::after {
  --rotation: 15deg;
  left: 25%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(var(--rotation));
}

/* 为每个第n个AI结果设置不同的位置 */
.bookmark-item.ai-result:nth-child(3n)::before {
  --rotation: 30deg;
  right: 35%;
}

.bookmark-item.ai-result:nth-child(3n)::after {
  --rotation: -30deg;
  left: 15%;
}

.bookmark-item.ai-result:nth-child(3n+1)::before {
  --rotation: -45deg;
  right: 25%;
}

.bookmark-item.ai-result:nth-child(3n+1)::after {
  --rotation: 45deg;
  left: 35%;
}

.bookmark-item.ai-result:nth-child(3n+2)::before {
  --rotation: 15deg;
  right: 20%;
}

.bookmark-item.ai-result:nth-child(3n+2)::after {
  --rotation: -15deg;
  left: 30%;
}

@keyframes floatAI {
  0%, 100% {
    transform: translate(var(--x), -50%) rotate(var(--rotation));
  }
  50% {
    transform: translate(var(--x), -45%) rotate(var(--rotation));
  }
}

.bookmark-item.ai-result::before,
.bookmark-item.ai-result::after {
  animation: floatAI 3s ease-in-out infinite;
  --x: 50%;
}

.bookmark-favicon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  object-fit: contain;
  background-color: transparent;
  border-radius: 2px;
  display: block;
  flex-shrink: 0;
}

/* 添加图标加载时的占位样式 */
.bookmark-favicon:not([src]), 
.bookmark-favicon[src=""] {
  background-color: #e0e0e0;
  border-radius: 2px;
}

.bookmark-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.preview-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: white;
  overflow: hidden;  /* 防止内容溢出 */
}

.preview-container.previewing .preview-toolbar {
  opacity: 1;
}

.preview-content {
  flex: 1;
  position: relative;
  display: flex;
  background: #f5f5f5;
}

#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#previewFrame.loaded {
  opacity: 1;
}

/* 加载指示器样式 */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 10;
}

.loading-indicator.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  position: relative;
  width: 48px;
  height: 48px;
}

.loading-spinner::before,
.loading-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.15),
    rgba(121, 40, 202, 0.15),
    rgba(14, 165, 233, 0.15)
  );
  background-size: 400% 400%;
  animation: pulseAndGradient 3s ease-in-out infinite;
  opacity: 0.8;
}

.loading-spinner::after {
  animation-delay: -1.5s;
}

@keyframes pulseAndGradient {
  0% {
    transform: scale(0.6);
    background-position: 0% 50%;
    filter: blur(0px);
  }
  50% {
    transform: scale(1);
    background-position: 100% 50%;
    filter: blur(3px);
  }
  100% {
    transform: scale(0.6);
    background-position: 0% 50%;
    filter: blur(0px);
  }
}

.loading-spinner-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 3px solid transparent;
  border-top-color: rgba(255, 0, 128, 0.5);
  border-right-color: rgba(121, 40, 202, 0.5);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.loading-indicator > div:last-child {
  color: #666;
  font-size: 14px;
  font-weight: 500;
  background: linear-gradient(135deg,
    rgba(255, 0, 128, 0.8),
    rgba(121, 40, 202, 0.8),
    rgba(14, 165, 233, 0.8)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  text-shadow: 0 0 20px rgba(255, 0, 128, 0.05);
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.app-header {
  display: flex;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.app-logo {
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
              0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-logo:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              0 1px 4px rgba(0, 0, 0, 0.12);
}

.app-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #333;
}

.bookmark-item.active {
  background-color: #f0f2f5;
}

/* 活动状态的悬停效果 */
.bookmark-item.active:hover {
  background-color: #f0f2f5;
}

.preview-cache {
  display: none; /* 隐藏缓存容器 */
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.preview-cache iframe {
  border: none;
}

/* 预览工具栏 */
.preview-toolbar {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid #eee;
  background: white;
  height: 48px;
  box-sizing: border-box;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 99;
}

.preview-container.previewing .preview-toolbar {
  opacity: 1;
}

/* 预览内容区域 */
.preview-content {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f5f5f5;
}

#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#previewFrame.loaded {
  opacity: 1;
}

/* 工具栏按钮通用样式 */
.toolbar-button {
  background: transparent;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 6px;
  margin: 0 2px;
  position: relative;
  z-index: 100;
  user-select: none;
}

.toolbar-button:hover {
  background: rgba(66, 133, 244, 0.1);
  transform: translateY(-1px);
}

.toolbar-button:active {
  transform: translateY(0);
  background: rgba(66, 133, 244, 0.2);
}

.toolbar-button svg {
  fill: #666;
  transition: all 0.2s ease;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.toolbar-button:hover svg {
  fill: #4285f4;
}

/* 刷新按钮旋转动画 */
.toolbar-button.refreshing svg {
  animation: rotate360 0.5s ease;
}

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 添加一个覆盖层来处理边界区域的鼠标事件 */
.boundary-handler {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 290px; /* 搜索容器宽度 - 20px */
  width: 20px; /* 边界区域宽度 */
  z-index: 2;
}

.preview-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 14px;
  text-align: center;
  max-width: 80%;
  line-height: 1.5;
  opacity: 0.8;
}

.preview-container.previewing .preview-hint {
  display: none;
}

.ai-search-status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: #666;
  font-size: 13px;
  gap: 12px;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.08), 
    rgba(121, 40, 202, 0.08), 
    rgba(14, 165, 233, 0.08)
  );
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border-radius: 8px;
  margin: 8px 2px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* AI搜索动画容器 */
.ai-spinner {
  position: relative;
  width: 20px;
  height: 20px;
}

/* 脉冲圆环动画 */
.ai-spinner::before,
.ai-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  background-size: 200% 200%;
  animation: pulse 2s ease-out infinite, gradientShift 3s ease infinite;
  opacity: 0.6;
}

.ai-spinner::after {
  animation-delay: -1s;
}

@keyframes pulse {
  0% {
    transform: scale(0);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* 旋转光环效果 */
.ai-spinner-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: rgb(255, 0, 128);
  border-right-color: rgb(121, 40, 202);
  border-radius: 50%;
  animation: spinnerRotate 1s linear infinite;
}

@keyframes spinnerRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 背景动画效果 */
.ai-search-status::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 0, 128, 0.1) 0%,
    rgba(121, 40, 202, 0.1) 25%,
    transparent 50%
  );
  animation: rotate 4s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 文字渐变动画 */
.ai-search-status span {
  background: linear-gradient(
    135deg,
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 3s ease infinite;
}

.bookmark-item.ai-result:hover {
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.12), 
    rgba(121, 40, 202, 0.12), 
    rgba(14, 165, 233, 0.12)
  );
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.bookmark-item.ai-result .bookmark-title {
  background: linear-gradient(135deg, 
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* QR Code 相关样式 */
.qrcode-popup {
  display: none;
  position: absolute;
  top: 40px;
  left: 10px;
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.qrcode-popup.show {
  display: block;
}

#qrcodeContainer {
  width: 128px;
  height: 128px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

#qrcodeContainer img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.qrcode-hint {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 工具栏按钮动画 */
.toolbar-button {
  transition: all 0.2s ease;
}

.toolbar-button:hover {
  transform: scale(1.05);
}

.toolbar-button:active {
  transform: scale(0.95);
}

.ai-search-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 0 8px 8px 0;
  height: calc(100% - 4px);
  margin: 2px;
  background: transparent;
}

#searchInput:focus ~ .ai-search-toggle {
  background: transparent;
}

.toggle-label {
  font-size: 14px;
  color: #666;
}

/* 开关样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.3), 
    rgba(121, 40, 202, 0.3), 
    rgba(14, 165, 233, 0.3)
  );
  transition: .3s;
  border-radius: 20px;
  overflow: hidden;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  z-index: 2;
}

.ai-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.8;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

input:checked + .slider {
  background: linear-gradient(135deg, 
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

input:checked + .slider:before {
  transform: translateX(16px);
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider .ai-icon {
  color: #fff;
  left: 6px;
  right: auto;
}

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 10;
}

.loading-indicator.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  position: relative;
  width: 48px;
  height: 48px;
}

.loading-spinner::before,
.loading-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.15),
    rgba(121, 40, 202, 0.15),
    rgba(14, 165, 233, 0.15)
  );
  background-size: 400% 400%;
  animation: pulseAndGradient 3s ease-in-out infinite;
  opacity: 0.8;
}

.loading-spinner::after {
  animation-delay: -1.5s;
}

@keyframes pulseAndGradient {
  0% {
    transform: scale(0.6);
    background-position: 0% 50%;
    filter: blur(0px);
  }
  50% {
    transform: scale(1);
    background-position: 100% 50%;
    filter: blur(3px);
  }
  100% {
    transform: scale(0.6);
    background-position: 0% 50%;
    filter: blur(0px);
  }
}

.loading-spinner-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 3px solid transparent;
  border-top-color: rgba(255, 0, 128, 0.5);
  border-right-color: rgba(121, 40, 202, 0.5);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.loading-indicator > div:last-child {
  color: #666;
  font-size: 14px;
  font-weight: 500;
  background: linear-gradient(135deg,
    rgba(255, 0, 128, 0.8),
    rgba(121, 40, 202, 0.8),
    rgba(14, 165, 233, 0.8)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  text-shadow: 0 0 20px rgba(255, 0, 128, 0.05);
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.loading-indicator > div {
  color: #666;
  font-size: 14px;
}

.close-preview-button {
  display: none !important;
}

.preview-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 14px;
  text-align: center;
  max-width: 80%;
  line-height: 1.5;
  opacity: 0.8;
}

.preview-container.previewing .preview-hint {
  display: none;
}

.ai-search-status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: #666;
  font-size: 13px;
  gap: 12px;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.08), 
    rgba(121, 40, 202, 0.08), 
    rgba(14, 165, 233, 0.08)
  );
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border-radius: 8px;
  margin: 8px 2px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* AI搜索动画容器 */
.ai-spinner {
  position: relative;
  width: 20px;
  height: 20px;
}

/* 脉冲圆环动画 */
.ai-spinner::before,
.ai-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  background-size: 200% 200%;
  animation: pulse 2s ease-out infinite, gradientShift 3s ease infinite;
  opacity: 0.6;
}

.ai-spinner::after {
  animation-delay: -1s;
}

@keyframes pulse {
  0% {
    transform: scale(0);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* 旋转光环效果 */
.ai-spinner-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: rgb(255, 0, 128);
  border-right-color: rgb(121, 40, 202);
  border-radius: 50%;
  animation: spinnerRotate 1s linear infinite;
}

@keyframes spinnerRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 背景动画效果 */
.ai-search-status::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 0, 128, 0.1) 0%,
    rgba(121, 40, 202, 0.1) 25%,
    transparent 50%
  );
  animation: rotate 4s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 文字渐变动画 */
.ai-search-status span {
  background: linear-gradient(
    135deg,
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 3s ease infinite;
}

.bookmark-item.ai-result:hover {
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.12), 
    rgba(121, 40, 202, 0.12), 
    rgba(14, 165, 233, 0.12)
  );
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.bookmark-item.ai-result .bookmark-title {
  background: linear-gradient(135deg, 
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* QR Code 相关样式 */
.qrcode-popup {
  display: none;
  position: absolute;
  top: 40px;
  left: 10px;
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.qrcode-popup.show {
  display: block;
}

#qrcodeContainer {
  width: 128px;
  height: 128px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

#qrcodeContainer img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.qrcode-hint {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 工具栏按钮动画 */
.toolbar-button {
  transition: all 0.2s ease;
}

.toolbar-button:hover {
  transform: scale(1.05);
}

.toolbar-button:active {
  transform: scale(0.95);
}

.ai-search-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 0 8px 8px 0;
  height: calc(100% - 4px);
  margin: 2px;
  background: transparent;
}

#searchInput:focus ~ .ai-search-toggle {
  background: transparent;
}

.toggle-label {
  font-size: 14px;
  color: #666;
}

/* 开关样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.3), 
    rgba(121, 40, 202, 0.3), 
    rgba(14, 165, 233, 0.3)
  );
  transition: .3s;
  border-radius: 20px;
  overflow: hidden;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  z-index: 2;
}

.ai-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.8;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

input:checked + .slider {
  background: linear-gradient(135deg, 
    rgb(255, 0, 128),
    rgb(121, 40, 202),
    rgb(14, 165, 233)
  );
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

input:checked + .slider:before {
  transform: translateX(16px);
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider .ai-icon {
  color: #fff;
  left: 6px;
  right: auto;
}

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 10;
}

.loading-indicator.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  position: relative;
  width: 48px;
  height: 48px;
}

.loading-spinner::before,
.loading-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgba(255, 0, 128, 0.15),
    rgba(121, 40, 202, 0.15),
    rgba(14, 165, 233, 0.15)
  );
  background-size: 400% 400%;
  animation: pulseAndGradient 3s ease-in-out infinite;
  opacity: 0.8;
}

.loading-spinner::after {
  animation-delay: -1.5s;
}

@keyframes pulseAndGradient {
  0% {
    transform: scale(0.6);
    background-position: 0% 50%;
    filter: blur(0px);
  }
  50% {
    transform: scale(1);
    background-position: 100% 50%;
    filter: blur(3px);
  }
  100% {
    transform: scale(0.6);
    background-position: 0% 50%;
    filter: blur(0px);
  }
}

.loading-spinner-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 3px solid transparent;
  border-top-color: rgba(255, 0, 128, 0.5);
  border-right-color: rgba(121, 40, 202, 0.5);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.loading-indicator > div:last-child {
  color: #666;
  font-size: 14px;
  font-weight: 500;
  background: linear-gradient(135deg,
    rgba(255, 0, 128, 0.8),
    rgba(121, 40, 202, 0.8),
    rgba(14, 165, 233, 0.8)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  text-shadow: 0 0 20px rgba(255, 0, 128, 0.05);
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.loading-indicator > div {
  color: #666;
  font-size: 14px;
}

.close-preview-button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 1000;
  transition: background-color 0.2s;
}

.close-preview-button:hover {
  background: rgba(0, 0, 0, 0.7);
} 